{template header}

    {template title}

    <div class="box">
    <!--{if $this->type == 'optimize' or $this->type == 'backup'}-->
        <table cellpadding="1" cellspacing="1" width="100%" border="0">
            <tr>
                <th width="7%">选择</th>
                <th>表名称</th>
                <th width="15%">状态</th>
                <th width="10%">记录</th>
                <th width="10%">大小</th>
            </tr>
        <!--{if $tables}-->
            <!--{loop $tables $t}-->
            <tr>
                <td><input type="checkbox" name="id" value="{$t['Name']}" /></td>
                <td>{$t['Name']}</td>
                <td>{$t['Data_free'] <= 0 ? '正常' : '<b style="color: blue;">需要修复</b>'}</td>
                <td>{$t['Rows']}</td>
                <td>{echo formatFileSize($t['Data_length'] + $t['Index_length'], 1)}</td>
            </tr>
            <!--{/loop}-->
        <!--{/if}-->

            <tr>
                <td colspan="5" class="td2 multiple">
                    <button class="btn btn-small btn-info btn-all">全选</button>
                    <!--{if $this->type == 'optimize'}-->
                    <a class="btn btn-small btn-success" href="{$this->url($c, 'optimize')}" title="修复表">修复表</a>
                    <!--{else}-->
                    <a class="btn btn-small btn-success" href="{$this->url($c, 'backup')}" title="备份数据">备份数据</a>
                    <!--{/if}-->
                </td>
            </tr>
            <script type="text/javascript">
                $( ".btn-all" ).html( '反选' );
                $( 'input[name="id"]' ).attr( 'checked', true );
            </script>
        </table>
        <!--{/if}-->
        <!--{if $this->type == 'restore'}-->
        <table cellpadding="1" cellspacing="1" width="100%" border="0">
            <tr>
                <th class="td2">备份文件</th>
                <th width="12%">备份时间</th>
                <th width="10%">大小</th>
                <th width="13%">操作</th>
            </tr>
            <!--{if $backFiles}-->
            <!--{loop $backFiles $t}-->
            <tr>
                <td class="td2">{$t['name']}</td>
                <td>{echo formatDate($t['time'])}</td>
                <td>{echo formatFileSize($t['size'])}</td>
                <td>
                    <a class="btn btn-small btn-danger del" href="{$this->url($c, 'del_backup', array('v'=> $t['time'] ) )}" title="删除备份文件">删除</a>
                    <a class="btn btn-small btn-success get" href="{$this->url($c, 'restore', array('v'=> $t['time'] ) )}" title="恢复数据">恢复</a>
                </td>
            </tr>
            <!--{/loop}-->
            <!--{else}-->
            <tr>
                <td colspan="4">没有备份文件！</td>
            </tr>
            <!--{/if}-->
        </table>
        <!--{/if}-->
        <!--{if $this->type == 'sql'}-->
        <form method="post" action="{$this->url($c, 'run_sql')}">
            <table cellpadding="1" cellspacing="1" width="100%" border="0">
                <tr>
                    <th class="td2">注意：不支持查询语句。</th>
                </tr>
                <tr>
                    <td class="td2">
                        <textarea name="sql" placeholder="请输入SQL语句" class="required" style="width: 40%;height: 120px;"></textarea>
                    </td>
                </tr>
                <tr>
                    <td class="td2">
                        <a href="" class="save btn btn-success">运行SQL</a>
                    </td>
                </tr>
            </table>
        </form>
        <!--{/if}-->
    </div>
{template footer}